3.3 \(\int (a+b \cot ^2(c+d x))^2 \, dx\)

Optimal. Leaf size=47 \[ -\frac{b (2 a-b) \cot (c+d x)}{d}+x (a-b)^2-\frac{b^2 \cot ^3(c+d x)}{3 d} \]

[Out]

(a - b)^2*x - ((2*a - b)*b*Cot[c + d*x])/d - (b^2*Cot[c + d*x]^3)/(3*d)

________________________________________________________________________________________

Rubi [A]  time = 0.0333153, antiderivative size = 47, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 14, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.214, Rules used = {3661, 390, 203} \[ -\frac{b (2 a-b) \cot (c+d x)}{d}+x (a-b)^2-\frac{b^2 \cot ^3(c+d x)}{3 d} \]

Antiderivative was successfully verified.

[In]

Int[(a + b*Cot[c + d*x]^2)^2,x]

[Out]

(a - b)^2*x - ((2*a - b)*b*Cot[c + d*x])/d - (b^2*Cot[c + d*x]^3)/(3*d)

Rule 3661

Int[((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x]
, x]}, Dist[(c*ff)/f, Subst[Int[(a + b*(ff*x)^n)^p/(c^2 + ff^2*x^2), x], x, (c*Tan[e + f*x])/ff], x]] /; FreeQ
[{a, b, c, e, f, n, p}, x] && (IntegersQ[n, p] || IGtQ[p, 0] || EqQ[n^2, 4] || EqQ[n^2, 16])

Rule 390

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^(q_), x_Symbol] :> Int[PolynomialDivide[(a + b*x^n)
^p, (c + d*x^n)^(-q), x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && IGtQ[n, 0] && IGtQ[p, 0] && ILt
Q[q, 0] && GeQ[p, -q]

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rubi steps

\begin{align*} \int \left (a+b \cot ^2(c+d x)\right )^2 \, dx &=-\frac{\operatorname{Subst}\left (\int \frac{\left (a+b x^2\right )^2}{1+x^2} \, dx,x,\cot (c+d x)\right )}{d}\\ &=-\frac{\operatorname{Subst}\left (\int \left ((2 a-b) b+b^2 x^2+\frac{(a-b)^2}{1+x^2}\right ) \, dx,x,\cot (c+d x)\right )}{d}\\ &=-\frac{(2 a-b) b \cot (c+d x)}{d}-\frac{b^2 \cot ^3(c+d x)}{3 d}-\frac{(a-b)^2 \operatorname{Subst}\left (\int \frac{1}{1+x^2} \, dx,x,\cot (c+d x)\right )}{d}\\ &=(a-b)^2 x-\frac{(2 a-b) b \cot (c+d x)}{d}-\frac{b^2 \cot ^3(c+d x)}{3 d}\\ \end{align*}

Mathematica [A]  time = 1.13173, size = 71, normalized size = 1.51 \[ -\frac{\cot (c+d x) \left (b \left (6 a+b \cot ^2(c+d x)-3 b\right )+3 (a-b)^2 \sqrt{-\tan ^2(c+d x)} \tanh ^{-1}\left (\sqrt{-\tan ^2(c+d x)}\right )\right )}{3 d} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + b*Cot[c + d*x]^2)^2,x]

[Out]

-(Cot[c + d*x]*(b*(6*a - 3*b + b*Cot[c + d*x]^2) + 3*(a - b)^2*ArcTanh[Sqrt[-Tan[c + d*x]^2]]*Sqrt[-Tan[c + d*
x]^2]))/(3*d)

________________________________________________________________________________________

Maple [A]  time = 0.004, size = 68, normalized size = 1.5 \begin{align*}{\frac{1}{d} \left ( -{\frac{{b}^{2} \left ( \cot \left ( dx+c \right ) \right ) ^{3}}{3}}-2\,\cot \left ( dx+c \right ) ab+{b}^{2}\cot \left ( dx+c \right ) + \left ( -{a}^{2}+2\,ab-{b}^{2} \right ) \left ({\frac{\pi }{2}}-{\rm arccot} \left (\cot \left ( dx+c \right ) \right ) \right ) \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*cot(d*x+c)^2)^2,x)

[Out]

1/d*(-1/3*b^2*cot(d*x+c)^3-2*cot(d*x+c)*a*b+b^2*cot(d*x+c)+(-a^2+2*a*b-b^2)*(1/2*Pi-arccot(cot(d*x+c))))

________________________________________________________________________________________

Maxima [A]  time = 1.47559, size = 85, normalized size = 1.81 \begin{align*} a^{2} x - \frac{2 \,{\left (d x + c + \frac{1}{\tan \left (d x + c\right )}\right )} a b}{d} + \frac{{\left (3 \, d x + 3 \, c + \frac{3 \, \tan \left (d x + c\right )^{2} - 1}{\tan \left (d x + c\right )^{3}}\right )} b^{2}}{3 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*cot(d*x+c)^2)^2,x, algorithm="maxima")

[Out]

a^2*x - 2*(d*x + c + 1/tan(d*x + c))*a*b/d + 1/3*(3*d*x + 3*c + (3*tan(d*x + c)^2 - 1)/tan(d*x + c)^3)*b^2/d

________________________________________________________________________________________

Fricas [B]  time = 1.64923, size = 296, normalized size = 6.3 \begin{align*} \frac{2 \, b^{2} \cos \left (2 \, d x + 2 \, c\right ) - 2 \,{\left (3 \, a b - 2 \, b^{2}\right )} \cos \left (2 \, d x + 2 \, c\right )^{2} + 6 \, a b - 2 \, b^{2} + 3 \,{\left ({\left (a^{2} - 2 \, a b + b^{2}\right )} d x \cos \left (2 \, d x + 2 \, c\right ) -{\left (a^{2} - 2 \, a b + b^{2}\right )} d x\right )} \sin \left (2 \, d x + 2 \, c\right )}{3 \,{\left (d \cos \left (2 \, d x + 2 \, c\right ) - d\right )} \sin \left (2 \, d x + 2 \, c\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*cot(d*x+c)^2)^2,x, algorithm="fricas")

[Out]

1/3*(2*b^2*cos(2*d*x + 2*c) - 2*(3*a*b - 2*b^2)*cos(2*d*x + 2*c)^2 + 6*a*b - 2*b^2 + 3*((a^2 - 2*a*b + b^2)*d*
x*cos(2*d*x + 2*c) - (a^2 - 2*a*b + b^2)*d*x)*sin(2*d*x + 2*c))/((d*cos(2*d*x + 2*c) - d)*sin(2*d*x + 2*c))

________________________________________________________________________________________

Sympy [A]  time = 0.312768, size = 68, normalized size = 1.45 \begin{align*} \begin{cases} a^{2} x - 2 a b x - \frac{2 a b \cot{\left (c + d x \right )}}{d} + b^{2} x - \frac{b^{2} \cot ^{3}{\left (c + d x \right )}}{3 d} + \frac{b^{2} \cot{\left (c + d x \right )}}{d} & \text{for}\: d \neq 0 \\x \left (a + b \cot ^{2}{\left (c \right )}\right )^{2} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*cot(d*x+c)**2)**2,x)

[Out]

Piecewise((a**2*x - 2*a*b*x - 2*a*b*cot(c + d*x)/d + b**2*x - b**2*cot(c + d*x)**3/(3*d) + b**2*cot(c + d*x)/d
, Ne(d, 0)), (x*(a + b*cot(c)**2)**2, True))

________________________________________________________________________________________

Giac [B]  time = 1.18206, size = 154, normalized size = 3.28 \begin{align*} \frac{b^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} + 24 \, a b \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - 15 \, b^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + 24 \,{\left (a^{2} - 2 \, a b + b^{2}\right )}{\left (d x + c\right )} - \frac{24 \, a b \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} - 15 \, b^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} + b^{2}}{\tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3}}}{24 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*cot(d*x+c)^2)^2,x, algorithm="giac")

[Out]

1/24*(b^2*tan(1/2*d*x + 1/2*c)^3 + 24*a*b*tan(1/2*d*x + 1/2*c) - 15*b^2*tan(1/2*d*x + 1/2*c) + 24*(a^2 - 2*a*b
 + b^2)*(d*x + c) - (24*a*b*tan(1/2*d*x + 1/2*c)^2 - 15*b^2*tan(1/2*d*x + 1/2*c)^2 + b^2)/tan(1/2*d*x + 1/2*c)
^3)/d